import {Alert, AsyncStorage} from "react-native";
import Storage from "react-native-storage";
import Toast from "react-native-root-toast";
import store from "../redux/store/configStore";
import * as MineAction from "../redux/action/Mine";
import * as CarConfig from "../config/Car";
import RNFS from "react-native-fs";
const Util = {};
Util.isDevelop = __DEV__;

const server = 'http://www.chehangjia.cn:8080/';
// const server = 'http://192.168.1.134:8080/';
const serverUrl = server + 'chj/'; // for app service

Util.ImgSmallServicePath = server + "chj_pic_server/press256pic/";
Util.ImgMiddleServicePath = server + "chj_pic_server/press512pic/";
Util.ImgBigServicePath = server + "chj_pic_server/";

Util.server = server;

const storage = new Storage({
    // maximum capacity, default 1000
    size: 1000000000,

    // Use AsyncStorage for RN, or window.localStorage for web.
    // If not set, data would be lost after reload.
    storageBackend: AsyncStorage,

    // expire time, default 1 day(1000 * 3600 * 24 milliseconds).
    // can be null, which means never expire.
    defaultExpires: null,

    // cache data in the memory. default is true.
    enableCache: true,

    // if data was not found in storage or expired,
    // the corresponding sync method will be invoked and return
    // the latest data.
    sync: {
        // we'll talk about the details later.
    }
});

Util.storage = storage;

Util.carBrand = {};
Util.carSeries = {};
Util.carModels = {};


Util.parseCarJson = function (carJson) {
    const carChars = Object.keys(carJson);
    // 遍历字母
    for (let i = 0; i < carChars.length; i++) {
        // 创建一个车辆品牌名字的数组
        let carBrandsName = [];
        // 从json中取到所有品牌数据
        let brands = carJson[carChars[i]].brands;
        for (let j = 0; j < brands.length; j++) {
            // 把车辆品牌名字放入数组
            carBrandsName.push(brands[j].name);

            // 处理车辆系列的名字
            let series = brands[j].series;
            let carSeriesName = [];
            for (let k = 0; k < series.length; k++) {
                carSeriesName.push(series[k].name);

                // 处理车辆型号的名字
                let models = series[k].models;
                let carModelList = [];
                for (let l = 0; l < models.length; l++) {
                    carModelList.push(models[l]);
                }
                Util.carModels[series[k].name] = carModelList;
            }
            Util.carSeries[brands[j].name] = carSeriesName;
        }
        Util.carBrand[carChars[i]] = carBrandsName;
    }
}

const jumpTo = function (navigator, routeComponent) {
    let routes = navigator.getCurrentRoutes();
    for (let i = 0; i < routes.length; i++) {
        if (routes[i].component === routeComponent) {
            navigator.jumpTo(routes[i]);
            return true;
        }
    }
    return false;
};

Util.popToRoute = function (navigator, routeComponent) {
    let routes = navigator.getCurrentRoutes();
    for (let i = 0; i < routes.length; i++) {
        if (routes[i].component === routeComponent) {
            navigator.popToRoute(routes[i]);
            return true;
        }
    }
    return false;
}

Util.getTimeString = function (date) {
    let m = date.getMonth() + 1;
    let t = date.getFullYear() + "-" + m + "-"
        + date.getDate() + " " + date.getHours() + ":"
        + date.getMinutes() + ":" + date.getSeconds();
    return t;
}

Util.getTimeStringFromMillis = function (millis) {
    let date = new Date(millis);
    return Util.getTimeString(date);
}

Util.decodePhotoString = function (optionString) {
    console.log('Util decodePhotoString  optionString  ' + optionString);
    let dataModel = [];
    let splitArr = optionString.split(',');
    for (let i = 0; i < splitArr.length; i++) {
        let splitSpliteArr = splitArr[i].split('#');
        dataModel.push(
            {
                name: splitSpliteArr[0],
                remotePic: splitSpliteArr[1],
                localPic: splitSpliteArr[2],
                extra: splitSpliteArr.length >= 4 ? splitSpliteArr[3] : null
            }
        );
    }
    return dataModel;
}

Util.encodePhotoModel = function (dataModel) {
    let optionString = '';
    for (let i = 0; i < dataModel.length; i++) {
        let node = dataModel[i];
        optionString += node.name + '#' + node.remotePic + '#' + node.localPic;

        if (node.extra) {
            optionString += '#' + node.extra;
        }
        if (i < dataModel.length - 1) {
            optionString += ',';
        }
    }
    return optionString;
}

Util.decodePhotoStringToViewString = function (optionString) {
    let dataModel = Util.decodePhotoString(optionString);
    let viewString = '';
    for (let i = 0; i < dataModel.length; i++) {
        let node = dataModel[i];
        if (node.localPic !== 'null') {
            viewString += node.name;
            viewString += ',';
        }
    }
    return viewString === '' ? '正常' : viewString;
}

Util.saveData = function (saveKey, saveData, callback = () => {
}) {
    if (!saveData) {
        Alert.alert('错误', '保存的数据不能为空');
        return;
    }

    if (!saveData.saveId) {
        storage.getIdsForKey(saveKey).then(
            (ids) => {
                let newId = '0';
                if (ids && ids.length > 0) {
                    for (let i = 0; i < ids.length; i++) {
                        let tmpId = parseInt(ids[i]);
                        if (tmpId >= parseInt(newId)) {
                            newId = (tmpId + 1).toString();
                        }
                    }
                }
                saveData.lastModify = Util.getTimeString(new Date());
                saveData.saveId = newId;
                storage.save({
                    id: newId,
                    key: saveKey,
                    rawData: saveData
                });
                callback();
            }
        );
    } else {
        saveData.lastModify = Util.getTimeString(new Date());
        storage.save({
            id: saveData.saveId,
            key: saveKey,
            rawData: saveData
        });
        callback();
    }
};

Util.saveDataSimple = function (key, rawData) {
    storage.save({
        key: key,
        rawData: rawData,
    });
};

Util.loadData = function (param) {
    const {
        key, autoSync = true, syncInBackground = true, syncParams = {
            extraFetchOptions: {
                // 各种参数
            },
            someFlag: true,
        }, sync = {},
    } = param;

    // sync方法的名字必须和所存数据的key完全相同
    // 方法接受的参数为一整个object，所有参数从object中解构取出
    // 这里可以使用promise。或是使用普通回调函数，但需要调用resolve或reject。
    storage.sync = sync;

    return new Promise((resolve, reject) => {
        storage.load({
            key: key,
            // autoSync(默认为true)意味着在没有找到数据或数据过期时自动调用相应的sync方法
            autoSync: autoSync,
            // syncInBackground(默认为true)意味着如果数据过期，
            // 在调用sync方法的同时先返回已经过期的数据。
            // 设置为false的话，则始终强制返回sync方法提供的最新数据(当然会需要更多等待时间)。
            syncInBackground: syncInBackground,
            // 你还可以给sync方法传递额外的参数
            syncParams: syncParams,
        }).then(ret => {
            // 如果找到数据，则在then方法中返回
            // 注意：这是异步返回的结果（不了解异步请自行搜索学习）
            // 你只能在then这个方法内继续处理ret数据
            // 而不能在then以外处理
            // 也没有办法“变成”同步返回
            // 你也可以使用“看似”同步的async/await语法
            console.log(ret.userid);
            resolve(ret);
        }).catch(err => {
            reject(err);
            //如果没有找到数据且没有sync方法，
            //或者有其他异常，则在catch中返回
            console.warn(err.message);
            switch (err.name) {
                case 'NotFoundError':
                    // TODO;
                    break;
                case 'ExpiredError':
                    // TODO
                    break;
            }
        });
    });
}
;

Util.jumpTo = jumpTo;

//deprecated
Util.user = {};

Util.getUser = () => {
    const {userData} = store.getState();
    console.log('getuser  id ' + userData.id + " phone " + userData.phone + ' token ' + userData.token + ' info ' + userData.info);
    return {
        id: userData.id,
        phone: userData.phone,
        token: userData.token,
        info: userData.info,
    };
}

Util.parseImageDataFromArray = function (dataArray) {
    let resultArray = [];
    if (!dataArray)
        return resultArray;
    for (let i = 0; i < dataArray.length; i++) {
        let data = dataArray[i];
        if (data.value && data.value.indexOf('#') !== -1) { /// 目前只能用这个特殊字符去判断是否为图片数据节点
            let dataModel = Util.decodePhotoString(data.value);
            for (let j = 0; j < dataModel.length; j++) {
                if (dataModel[j].localPic && dataModel[j].localPic !== 'null') // 遍历一下
                {
                    resultArray.push(data);
                    break;
                }
            }
        }
    }
    return resultArray;
}

Util.makeFileParams = function (photoString) {
    let params = [];

    let dataModel = Util.decodePhotoString(photoString);
    for (let i = 0; i < dataModel.length; i++) {
        let imagepath = dataModel[i].localPic;
        if (imagepath && imagepath !== 'null') {
            params.push(
                {
                    name: 'file' + i,
                    filename: 'image' + i + '.jpg',
                    filepath: imagepath,
                    filetype: 'image/jpg',
                    alias: dataModel[i].name
                }
            );
        }
    }
    return params;
};

Util.checkFileExist = function (path, name) {
    let url = path.replace('file://', '');
    console.log('UtilcheckFileExist path    ' + url);
    if (url) {
        RNFS.exists(url).then(ret => {
            console.log('UtilcheckFileExist ret  file  ' + ret);
            if (!ret) {
                Util.showToast(`${name} 图片损毁，请重新设置`);
            }
        }).catch(err => {
            console.log('UtilcheckFileExist err  file  ' + err);
        });
    }
};

Util.startUploadQueue = function (uploadData, onSuccessListener, onFailedListener) {
    const user = Util.getUser();
    let params = {
        token: user.token,
        userid: user.id
    };

    const uploadUrl = serverUrl + 'user/uploadpicfile';
    const formnatParam = new FormData();
    formnatParam.append('action', JSON.stringify(params));
    let type = 'application/octet-stream';
    let photoString = uploadData.value;
    console.log('Util  temp ' + JSON.stringify(uploadData));
    Util.makeFileParams(photoString).map(item => {
        Util.checkFileExist(item.filepath, item.alias);
        console.log('Util startUploadQueue    ' + JSON.stringify(item));
        formnatParam.append('' + item.filename, {uri: item.filepath, type: type, name: item.filename});
    });


    let isOk = false;
    fetch(uploadUrl, {
        method: 'POST',
        body: formnatParam,
        headers: {
            'Accept': 'application/json',
            'Content-Type': 'multipart/form-data',
        }
    })
        .then((response) => {
            console.log('_enterDetail response  ' + JSON.stringify(response));
            if (response.ok) {
                isOk = true;
            } else {
                isOk = false;
                onFailedListener();
            }
            return response.json();
        })
        .then(result => {
            // success goes here
            console.log('Util resul  ' + result);
            if (isOk) {

                if (result.status === '000') {
                    Util.storage.clearMapForKey('users');
                    store.dispatch();
                    onFailedListener('未登录或登录超时，请先登录');
                    return;
                }

                else if (result.status !== '0') {
                    onFailedListener(result.msg);
                    return;
                }

                let index = 0;
                let imgs = result.data.imgs;

                let dataModel = Util.decodePhotoString(uploadData.value);
                for (let i = 0; i < dataModel.length; i++) {
                    let node = dataModel[i];
                    if (node.localPic && node.localPic !== 'null') {
                        node.remotePic = imgs[index++];
                    }
                }
                uploadData.value = Util.encodePhotoModel(dataModel);
                console.log('Util success ' + JSON.stringify(uploadData));
                onSuccessListener();
            }
        })
        .catch((error) => {
            // error goes here
        });


};

Util.uploadImages = function (carData, onSuccessListener, onFailedListener) {
    let needUploadImagesList = [];
    // cias认证
    needUploadImagesList = needUploadImagesList.concat(Util.parseImageDataFromArray(carData.carface));
    needUploadImagesList = needUploadImagesList.concat(Util.parseImageDataFromArray(carData.carframe));
    needUploadImagesList = needUploadImagesList.concat(Util.parseImageDataFromArray(carData.carpictures));
    // 质保认证
    needUploadImagesList = needUploadImagesList.concat(Util.parseImageDataFromArray(carData.warrantyinfo));

    /// 没有需要上传的图片
    if (needUploadImagesList.length === 0) {
        onSuccessListener();
    } else {
        let successCount = 0;
        needUploadImagesList.map(item => {
            Util.startUploadQueue(item, () => {
                successCount++;
                console.log('Util succindesx  ' + successCount);
                if (successCount >= needUploadImagesList.length) {
                    onSuccessListener();
                }
            }, onFailedListener);
        });
    }
};

Util.postServer = function (api, params, onSuccessListener, onFailedListener) {
    let formdata = new FormData();
    formdata.append('action', JSON.stringify(params));
    let postOptions = {
        method: 'POST',
        headers: {},
        body: formdata
    };

    fetch(serverUrl + api, postOptions)
        .then((response) => response.text())
        .then((responseText) => {
            console.log(responseText);

            let result = JSON.parse(responseText);
            if (result.status && result.status === '000') {
                Util.storage.clearMapForKey('users');
                store.dispatch(MineAction.userData({}));
                onFailedListener(result.status + '未登录或登录超时，请先登录');
            } else if (result.status === '0') {
                onSuccessListener(result);
            } else {
                onFailedListener(result.msg);
            }
        })
        .catch(function (error) {
            onFailedListener(error.message);
        })
        .done();
};

// ----------------------- 参数检查 ------------------------------
Util.OK = '正常';

Util.checkCarData = function (carData) {
    let resultString = '';
    let result1 = Util.checkBasicInfo(carData);
    if (result1 !== Util.OK) {
        resultString += result1 + ' ';
    }

    let result3 = Util.checkCarConfig(carData);
    if (result3 !== Util.OK) {
        resultString += result3 + ' ';
    }

    let result2 = Util.checkMustPicture(carData);
    if (result2 !== Util.OK) {
        resultString += result2 + ' ';
    }

    if (resultString === '')
        return Util.OK;
    else {
        return resultString;
    }
}

Util.checkQainfo = function (carData) {
    if (!carData.qaDriveRoomOne
        || !carData.qaDriveRoomTwo
        || !carData.qaStart
        || !carData.qaEngineRoom
        || !carData.qaRoadTest
        || !carData.qaUnderpanOne
        || !carData.qaUnderpanTwo) {
        return '-质保信息录入不完整!!!';
    }
    return Util.OK;
};

Util.checkBasicInfo = function (carData) {
    if (!carData.basicinfo) {
        return '基本信息(01)未编辑';
    }
    for (let letiable in carData.basicinfo) {
        if (carData.basicinfo.hasOwnProperty(letiable)) {
            let obj = carData.basicinfo[letiable];
            if (obj.canbenull) {
                continue;
            }
            if (!obj.value || obj.value.length === 0 || obj.value === 'null') {
                return '基本信息(01)不完整';
                // return obj.name + '未填写';
            }
        }
    }
    return Util.OK;
}

Util.checkMustPicture = function (carData) {
    if (!carData.carpictures || carData.carpictures.length === 0) {
        return '必选照片未编辑';
    }
    let mustPicture = carData.carpictures[0];
    let dataModel = Util.decodePhotoString(mustPicture.value);

    let errorString = '缺少必选照片[';
    for (let i = 0; i < dataModel.length; i++) {
        if (dataModel[i].localPic === 'null') {
            errorString += dataModel[i].name + ' ';
        }
    }
    if (errorString === '缺少必选照片[')
        return Util.OK;
    else {
        return errorString + ']';
    }
}

Util.checkCarConfig = function (carData) {
    if (!carData.carconfig || carData.carconfig.length === 0) {
        return '车辆配置(02)未编辑';
    }
    for (let i = 0; i < carData.carconfig.length; i++) {
        let obj = carData.carconfig[i];
        if (obj.canbenull) {
            continue;
        }
        if (!obj.value || obj.value.length === 0 || obj.value === 'null') {
            return '车辆配置(02)不完整[' + obj.name + ']';
            // return obj.name + '未填写';
        }
    }
    return Util.OK;
}

Util.checkCiasOK = function (carData, isHelpLook = false) {
    if (!carData.basicinfo || !carData.carconfig || !carData.carcockpit
        || !carData.carface || !carData.carframe || !carData.carfunparts || !carData.carengine
        || !carData.carstart || !carData.carpictures) {
        if (!isHelpLook) {
            if (!carData.carbottom || !carData.carroadtest) {
                return '车辆信息填写不完整';
            }
        }
    }

    let status = checkOtherParam(carData);
    let mileage = carData.carconfig[1].value;
    if (parseFloat(mileage) > 15) {
        status += '里程大于15万公里 ';
    }

    let dateString = carData.basicinfo.firstrecorddate.value;
    if (dateString && dateString.length > 0) {
        let coty = dateString;
        let yMd = coty.split('-');
        let now = new Date()
        let oldDate = new Date();
        oldDate.setFullYear(parseInt(yMd[0]), parseInt(yMd[1]), parseInt(yMd[2]));

        let yearDelta = now.getFullYear() - oldDate.getFullYear();
        if (yearDelta > 7) {
            status += '车龄大于7年 ';
        }
        else if (yearDelta === 7) {
            if (now.getMonth() > oldDate.getMonth()) {
                status += '车龄大于7年 ';
            }
        }
    }
    else {
        status += '车龄信息未填写 ';
    }

    if (status === '')
        return Util.OK;
    else {
        return status;
    }
};
/*检查车的其他属性*/
function checkOtherParam(carData) {
    let status = '';

    let check1 = carData.carcockpit[16];
    if (check1.value === '否') {
        status += '有水泡 ';
    }

    let check2 = carData.carcockpit[17];
    if (check2.value === '否') {
        status += '有火烧 ';
    }

    let check3 = carData.carcockpit[18];
    if (check3.value === '否') {
        status += '有重大事故 ';
    }
    return status;
}

//应先满足  Util.checkCiasOK
Util.qaOK = function (carData) {
    if (!carData.basicinfo || !carData.carconfig || !carData.carcockpit
        || !carData.carface || !carData.carframe || !carData.carfunparts || !carData.carengine
        || !carData.carstart || !carData.carpictures) {
        return '车辆信息填写不完整';
    }
    console.log('Utl  ' + JSON.stringify(carData));
    let status = checkOtherParam(carData);
    if (!carData.carconfig) {
        return '';
    }
    let mileage = carData.carconfig[1].value;
    if (parseFloat(mileage) > 18) {
        status += '里程大于18万公里 ';
    }

    let dateString = carData.basicinfo.firstrecorddate.value;
    if (dateString && dateString.length > 0) {
        let coty = dateString;
        let yMd = coty.split('-');
        let now = new Date();
        let oldDate = new Date();
        oldDate.setFullYear(parseInt(yMd[0]), parseInt(yMd[1]), parseInt(yMd[2]));

        let yearDelta = now.getFullYear() - oldDate.getFullYear();
        if (yearDelta > 8) {
            status += '车龄大于8年 ';
        }
        else if (yearDelta === 8) {
            if (now.getMonth() > oldDate.getMonth()) {
                status += '车龄大于8年 ';
            }
        }
    }
    const brand = carData.basicinfo.carbrand;
    const vin = carData.basicinfo.vehiclevincode.value;
    const vinFirst = vin.toUpperCase().substring(0, 1);
    if (vinFirst === "L" && CarConfig.JOIN_VENTURE.indexOf(brand) === -1) {
        status += '国产车';
    }
    if (status === '')
        return Util.OK;
    else {
        return status;
    }
};
// --------------------------------------------------------------

// ------------------------- 参数生成 ----------------------------
Util.makeBasicParams = function (carData) {
    let params = {};

    for (let letiable in carData.basicinfo) {
        if (carData.basicinfo.hasOwnProperty(letiable)) {
            if (letiable === 'carmodel' && carData.basicinfo[letiable].value.name) {
                params[letiable] = carData.basicinfo[letiable].value.name;
                params['categoryid'] = carData.basicinfo[letiable].value.id;
            } else {
                params[letiable] = carData.basicinfo[letiable].value;
            }
        }
    }

    let dc = Util.defaultCarconfig();
    for (let i = 0; i < carData.carconfig.length; i++) {
        let alias = null;
        // 针对旧的数据，没有alias字段，就从默认数据中取
        if (!carData.carconfig[i].alias) {
            alias = dc[i].alias;
        }
        else {
            alias = carData.carconfig[i].alias;
        }

        alias = alias.trim().toLowerCase();

        params[alias] = carData.carconfig[i].value;
    }
    return params;
}

Util.parseExpandInfo = function (signName, expandinfo, defaultinfo) {
    let array = [];
    for (let i = 0; expandinfo && expandinfo.length && i < expandinfo.length; i++) {

        let alias = null;
        // 针对旧的数据，没有alias字段，就从默认数据中取
        if (!expandinfo[i].alias) {
            alias = defaultinfo[i].alias;
        }
        else {
            alias = expandinfo[i].alias;
        }

        alias = alias.trim().toLowerCase();

        array.push(
            {
                sign: signName,
                alias: alias,
                keyname: expandinfo[i].name,
                keyvalue: expandinfo[i].value
            }
        );
    }
    return array;
}

Util.makeExpandParams = function (carData, addAccredict) {
    let params = [];
    // 为了保证旧的数据正常, carconfig也保证提交
    params = params.concat(Util.parseExpandInfo('carconfig', carData.carconfig, Util.defaultCarconfig()));
    // ----
    params = params.concat(Util.parseExpandInfo('carframe', carData.carframe, Util.defaultCarframe()));
    params = params.concat(Util.parseExpandInfo('carface', carData.carface, Util.defaultCarface()));
    params = params.concat(Util.parseExpandInfo('carbottom', carData.carbottom, Util.defaultCarbottom()));
    params = params.concat(Util.parseExpandInfo('carcockpit', carData.carcockpit, Util.defaultCarcockpit()));
    params = params.concat(Util.parseExpandInfo('carengine', carData.carengine, Util.defaultCarengine()));
    params = params.concat(Util.parseExpandInfo('carfunparts', carData.carfunparts, Util.defaultCarfunparts()));
    params = params.concat(Util.parseExpandInfo('carroadtest', carData.carroadtest, Util.defaultCarroadtest()));
    params = params.concat(Util.parseExpandInfo('carstart', carData.carstart, Util.defaultCarstart()));
    if (addAccredict) {
        params = params.concat(Util.parseExpandInfo('carengine', carData.qaEngineRoom, Util.defaultGuaranteeEngineRoom()));
        params = params.concat(Util.parseExpandInfo('carcockpit', carData.qaDriveRoomOne, Util.defaultGuaranteeDriveRoomOne()));
        params = params.concat(Util.parseExpandInfo('carcockpit', carData.qaDriveRoomTwo, Util.defaultGuaranteeDriveRoomTwo()));
        params = params.concat(Util.parseExpandInfo('carstart', carData.qaStart, Util.defaultGuaranteeStart()));
        params = params.concat(Util.parseExpandInfo('carbottom', carData.qaUnderpanOne, Util.defaultGuaranteeUnderpanOne()));
        params = params.concat(Util.parseExpandInfo('carbottom', carData.qaUnderpanTwo, Util.defaultGuaranteeUnderpanTwo()));
        params = params.concat(Util.parseExpandInfo('carroadtest', carData.qaRoadTest, Util.defaultGuaranteeRoadTest()));
    }
    // TODO

    params.push(
        {
            sign: 'mustpicture',
            alias: 'mustpicture',
            keyname: carData.carpictures[0].name,
            keyvalue: carData.carpictures[0].value
        }
    )
    params.push(
        {
            sign: 'otherpicture',
            alias: 'otherpicture',
            keyname: carData.carpictures[1].name,
            keyvalue: carData.carpictures[1].value
        }
    )
    return params;
}

// --------------------------------------------------------------

Util.randRange = function GetRandomNum(Min, Max) {
    let Range = Max - Min;
    let Rand = Math.random();
    return (Min + Math.round(Rand * Range));
}

Util.calculateDate = function calculateDate(dateStr) {
    let dateStrArray = dateStr.split('-');
    let year = parseInt(dateStrArray[0]);
    let month = parseInt(dateStrArray[1]) - 1;
    let day = parseInt(dateStrArray[2]);

    let dateNow = new Date();

    let yearOffset = dateNow.getFullYear() - year;
    let monthOffset = dateNow.getMonth() - month;
    if (monthOffset < 0) {
        yearOffset -= 1;
        monthOffset += 12;
    }

    if (monthOffset === 0) {
        return yearOffset + '年';
    }
    return yearOffset + '年零' + monthOffset + '个月';
}

Util.splitDateDay = function (dateStr) {
    let dateStrArray = dateStr.split('-');
    return dateStrArray[0] + '年' + dateStrArray[1] + '月';
}

Util.showToast = function (msg) {
    Toast.show(msg, {
        duration: Toast.durations.SHORT,
        position: Toast.positions.CENTER,
        shadow: true,
        animation: true,
        hideOnPress: true,
        delay: 0,
    });
}

// ---------------------------------------------------- default数据 -------------------------------------------------------
// 01 --- basicinfo ---
Util.defaultBasicinfo = function () {
    let obj =
        {
            carbrand: {value: Util.isDevelop ? "奥迪" : "", name: "车辆品牌"},
            carseries: {value: Util.isDevelop ? "A6L" : "", name: "车辆系列"},
            carmodel: {value: Util.isDevelop ? "2016款" : "", name: "车辆型号"},
            vehiclevincode: {value: Util.isDevelop ? "fdsjklj2183fdlksfjla" : "", name: "车辆VIN码"},
            licencenumber: {value: Util.isDevelop ? "贵A88888" : "贵A", name: "牌照号码"},

            enginenumber: {value: Util.isDevelop ? "456789123" : "", name: "发动机号"},
            travelkilometer: {value: Util.isDevelop ? "3.2" : "", name: "行驶公里数", canbenull: true},
            vehicleorigin: {value: "合资", name: "车辆产地"},
            firstrecorddate: {value: Util.isDevelop ? "2015-09-09" : "", name: "首次登记日期"},
            leaverecorddate: {value: Util.isDevelop ? "2015-09-09" : "", name: "出厂日期"},

            onthecardtime: {value: Util.isDevelop ? "2015-09-09" : "", name: "上牌时间", canbenull: true},
            useproperty: {value: "家庭用车", name: "使用性质"},
            carownername: {value: Util.isDevelop ? "老勾" : "", name: "车主姓名"},
            carowneridcard: {value: Util.isDevelop ? "520101198706120122" : "", name: "车主（法人）身份证号"},
//					carterritorial: {value:Util.isDevelop?"贵阳":"贵州省 贵阳市", name:"车辆归属地"},
        carterritorial: {value: Util.isDevelop ? "贵州贵阳" : "贵州贵阳", name: "车辆归属地"},

        sid: {value: '', name: "车辆来源"},
        areaid: {value: '', name: '商家所在地'},

        presaleprice: {value: Util.isDevelop ? "3.2" : "", name: "预售价格（万元）"},
        yearlyinspectiondate: {value: Util.isDevelop ? "2015-09-09" : "", name: "年检证明"},
        proofoftraveltaxdate: {value: Util.isDevelop ? "2015-09-09" : "", name: "车船税证明"},
        stronginsurancedate: {value: Util.isDevelop ? "2015-09-09" : "", name: "交强险"},

        purchasetaxcertificate: {value: "有", name: "购置税证书"},
        licenseplate: {value: "有", name: "号牌"},
        drivinglicense: {value: "有", name: "行驶证"},
        registrationcertificate: {value: "有", name: "登记证书"},
        insurancepolicy: {value: "有", name: "保险单"},

        endorsement: {value: "无", name: "违章记录"},
        caruseInstructions: {value: "有", name: "车辆使用说明"},
        transfertimes: {value: "1", name: "过户次数"},

        tradeinfotype: {value: "个人", name: "成交信息类型", canbenull: true},

        tradesubject: {value: Util.isDevelop ? "测试" : "", name: "客户姓名", canbenull: true},
        tradesubcode: {value: Util.isDevelop ? "none" : "", name: "证件号码", canbenull: true},
        tradecontacts: {value: Util.isDevelop ? "二代身份证" : "二代身份证", name: "客户类型", canbenull: true},
        tradecontactnumber: {value: Util.isDevelop ? "13911103484" : "", name: "联系电话", canbenull: true},
        tradecontactaddress: {value: Util.isDevelop ? "贵州贵阳" : "", name: "地址", canbenull: true},

        legalvoucher: {value: Util.isDevelop ? "" : "", name: "其他法定凭证", canbenull: true},
    };
    return obj;
};

Util.defaultHelpBasicInfo = function () {
    let obj =
        {
            carbrand: {value: Util.isDevelop ? "奥迪" : "", name: "车辆品牌"},
            carseries: {value: Util.isDevelop ? "A6L" : "", name: "车辆系列"},
            carmodel: {value: Util.isDevelop ? "2016款" : "", name: "车辆型号"},
            carownername: {value: Util.isDevelop ? "老勾" : "", name: "车主姓名"},
            tradecontactnumber: {value: Util.isDevelop ? "13911103484" : "", name: "联系电话"},
            vehiclevincode: {value: Util.isDevelop ? "fdsjklj2183fdlksfjla" : "", name: "车辆VIN码"},
            licencenumber: {value: Util.isDevelop ? "贵A88888" : "贵A", name: "牌照号码"},

            enginenumber: {value: Util.isDevelop ? "456789123" : "", name: "发动机号"},
            travelkilometer: {value: Util.isDevelop ? "3.2" : "", name: "行驶公里数", canbenull: true},
            vehicleorigin: {value: "合资", name: "车辆产地"},
            firstrecorddate: {value: Util.isDevelop ? "2015-09-09" : "", name: "首次登记日期"},
            leaverecorddate: {value: Util.isDevelop ? "2015-09-09" : "", name: "出厂日期"},

            onthecardtime: {value: Util.isDevelop ? "2015-09-09" : "", name: "上牌时间", canbenull: true},
            useproperty: {value: "家庭用车", name: "使用性质"},
//					carterritorial: {value:Util.isDevelop?"贵阳":"贵州省 贵阳市", name:"车辆归属地"},
        carterritorial: {value: Util.isDevelop ? "贵州贵阳" : "贵州贵阳", name: "车辆归属地"},
        areaid: {value: '', name: '商家所在地'},

        yearlyinspectiondate: {value: Util.isDevelop ? "2015-09-09" : "", name: "年检证明"},
        proofoftraveltaxdate: {value: Util.isDevelop ? "2015-09-09" : "", name: "车船税证明"},
        stronginsurancedate: {value: Util.isDevelop ? "2015-09-09" : "", name: "交强险"},

        purchasetaxcertificate: {value: "有", name: "购置税证书"},
        licenseplate: {value: "有", name: "号牌"},
        drivinglicense: {value: "有", name: "行驶证"},
        registrationcertificate: {value: "有", name: "登记证书"},
        insurancepolicy: {value: "有", name: "保险单"},

        endorsement: {value: "无", name: "违章记录"},
        caruseInstructions: {value: "有", name: "车辆使用说明"},
        transfertimes: {value: "1", name: "过户次数"},

        legalvoucher: {value: Util.isDevelop ? "" : "", name: "其他法定凭证", canbenull: true},
    };
    return obj;
};

// 02 --- carconfig ---
Util.defaultCarconfig = function () {
    let array =
        [
            {value: Util.isDevelop ? "白色" : "", name: "车身颜色", alias: 'bodycolor'},
            {value: Util.isDevelop ? "10" : "", name: "表征里程（万公里）", alias: 'travelkilometer'},
            {value: Util.isDevelop ? "12" : "", name: "推定里程（万公里）", alias: 'estimatedmileage'},
            {value: Util.isDevelop ? "92号汽油" : "", name: "燃油标号", alias: 'fuelabel'},
            {value: Util.isDevelop ? "2.0" : "", name: "排量（L）", alias: 'displacement'},
            {value: Util.isDevelop ? "4" : "", name: "缸数", alias: 'thenumberofcylinders'},
            {value: Util.isDevelop ? "220" : "", name: "发动机功率（KW）", alias: 'enginepower'},
            {value: Util.isDevelop ? "国五" : "", name: "排放标准", alias: 'emissionstandard'},
            {value: Util.isDevelop ? "MT" : "", name: "变速器形式", alias: 'transmissiontype'},
            {value: Util.isDevelop ? "8个以上" : "", name: "安全气囊", alias: 'safetyairbag'},
            {value: Util.isDevelop ? "全时四驱" : "", name: "驱动方式", alias: 'drivemode'},
            {value: "有", name: "ABS", alias: 'abs'},
            {value: Util.isDevelop ? "合金" : "合金", name: "轮毂材质", alias: 'hubmaterial'},
            {value: "", name: "其他重要配置", canbenull: true, alias: 'otherimportantconfigure'},
        ];
    return array;
}
// 03 --- carface ---
Util.defaultCarface = function () {
    let array = [
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "前挡风玻璃",
            alias: 'frontwindshieid'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "发动机舱盖表面",
            alias: 'enginehoodsurface'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "前大灯",
            alias: 'headlamp'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "中网格栅",
            alias: 'grille'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "前保险杠",
            alias: 'frontbumper'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "雾灯（左）",
            alias: 'foglampleft'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "雾灯（右）",
            alias: 'foglampright'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "右前翼子板",
            alias: 'rightfrontfender'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "右后视镜",
            alias: 'rightmirror'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "右前轮",
            alias: 'rightfrontwheel'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "右前车门",
            alias: 'rightfrontdoor'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "右后车门",
            alias: 'rightreardoor'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "右后翼子板",
            alias: 'rightrearfender'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "右后轮",
            alias: 'rightrearwheel'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "后挡风玻璃",
            alias: 'rearwindshield'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "行李箱盖",
            alias: 'rrunklid'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "行李箱盖附件",
            alias: 'lugcoveraccess'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "行李箱内侧",
            alias: 'insideluggage'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "后尾灯",
            alias: 'rearlamp'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "后保险杠",
            alias: 'rearbumper'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "后保险杠附件",
            alias: 'rearbumperattach'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "左后翼子板",
            alias: 'leftwinghouyi'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "左后轮",
            alias: 'leftrearwheel'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "左后车门",
            alias: 'leftreardoor'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "左前车门",
            alias: 'leftfrontdoor'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "左后视镜",
            alias: 'leftmirror'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "左前翼子板",
            alias: 'leftfrontfender'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "左前轮",
            alias: 'leftfrontwheel'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "车顶",
            alias: 'carroof'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "车顶附件",
            alias: 'roofaccess'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "四门风窗玻璃",
            alias: 'fourdoorwindowglass'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "四门附件",
            alias: 'fourdooraccess'
        },
        {
            value: "划痕#null#null#null,变形#null#null#null,锈蚀#null#null#null,裂纹#null#null#null,凹陷#null#null#null,修复痕迹#null#null#null",
            name: "挡泥板罩及内衬",
            alias: 'fendercoverlining'
        },

        {
            value: "破损#null#null,异物#null#null,裂纹#null#null,陈旧#null#null,鼓包#null#null,轮胎花纹深度小于1.6mm#null#null",
            name: "轮胎（右前）",
            alias: 'tyrefrontright'
        },
        {
            value: "破损#null#null,异物#null#null,裂纹#null#null,陈旧#null#null,鼓包#null#null,轮胎花纹深度小于1.6mm#null#null",
            name: "轮胎（右后）",
            alias: 'tyresrearright'
        },
        {
            value: "破损#null#null,异物#null#null,裂纹#null#null,陈旧#null#null,鼓包#null#null,轮胎花纹深度小于1.6mm#null#null",
            name: "轮胎（左前）",
            alias: 'tyrefrontleft'
        },
        {
            value: "破损#null#null,异物#null#null,裂纹#null#null,陈旧#null#null,鼓包#null#null,轮胎花纹深度小于1.6mm#null#null",
            name: "轮胎（左后）",
            alias: 'tyreleftrear'
        },
        {value: "", name: "车身外观检车备注", alias: 'thebodycheckrem'}
    ];
    return array;
}

// 04 --- carframe ---
Util.defaultCarframe = function () {
    return [
        {value: "正常", name: "车体整体对称性", alias: 'overallbodysymmetry'},
        {value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null", name: "左A柱", alias: 'leftacolumn'},
        {value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null", name: "左B柱", alias: 'leftbcolumn'},
        {value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null", name: "左C柱", alias: 'leftccolumn'},
        {value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null", name: "右A柱", alias: 'rightacolumn'},
        {value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null", name: "右B柱", alias: 'rightbcolumn'},
        {value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null", name: "右C柱", alias: 'rightccolumn'},
        {
            value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null",
            name: "左前纵梁",
            alias: 'leftfrontstringer'
        },
        {
            value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null",
            name: "右前纵梁",
            alias: 'rightfrontstringer'
        },
        {
            value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null",
            name: "左前减震器悬挂部位",
            alias: 'leftfrontsuspension'
        },
        {
            value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null",
            name: "右前减震器悬挂部位",
            alias: 'rightfrontsuspension'
        },
        {
            value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null",
            name: "左后减震器悬挂部位",
            alias: 'leftreardamperpart'
        },
        {
            value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null",
            name: "右后减震器悬挂部位",
            alias: 'rightreardamperpart'
        },
        {
            value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null",
            name: "左后纵梁",
            alias: 'leftrearstringer'
        },
        {
            value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null",
            name: "右后纵梁",
            alias: 'rightrearstringer'
        },
        {
            value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null",
            name: "后防火墙",
            alias: 'postfirewall'
        },
        {value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null", name: "后围板", alias: 'rearcowl'},
        {
            value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null",
            name: "行李箱底板",
            alias: 'luggagebottom'
        },
        {value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null", name: "驾驶室底板", alias: 'cabfloor'},
        {
            value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null",
            name: "驾驶室底板梁",
            alias: 'cabfloorbeam'
        },
        {value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null", name: "前横梁", alias: 'frontbeam'},
        {value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null", name: "龙门架", alias: 'longmenframe'},
        {
            value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null",
            name: "前防火墙",
            alias: 'frontfirewall'
        },
        {value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null", name: "后防撞梁", alias: 'rearimpact'},
        {value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null", name: "左底大边", alias: 'leftmargin'},
        {value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null", name: "右底大边", alias: 'rightmargin'},
        {
            value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null",
            name: "车顶右边梁",
            alias: 'roofrightbeam'
        },
        {
            value: "变形#null#null,扭曲#null#null,更换#null#null,烧焊#null#null,褶皱#null#null",
            name: "车顶左边梁",
            alias: 'roofleftbeam'
        },
    ];
}

// 05 --- carengine ---
Util.defaultCarengine = function () {
    return [
        {value: "无", name: "机油有无冷却液混入", alias: 'oilcoolantmixture'},
        {value: "无", name: "蓄电池电解液有无渗漏、缺少", alias: 'batteryelectleakage'},
        {value: "无", name: "缸盖外是否有机油渗漏", alias: 'oilleakageoutcylinder'},
        {value: "无", name: "发动机带有无老化", alias: 'enginewithnoaging'},
        {value: "无", name: "前翼子板内缘、水箱框架、横拉梁有无凹凸或修复痕迹", alias: 'frontwingframeismarks'},
        {value: "无", name: "油管、水管有无老化", alias: 'oilpipeswaterisaging'},
        {value: "无", name: "散热器格栅有无破损", alias: 'radiatorgrilleisdamage'},
        {value: "无", name: "线束有无老化、破损", alias: 'wireisagingdamaged'},
        {value: "无", name: "蓄电池电极桩柱有无腐蚀", alias: 'corrobatteleccolumn'},
        {value: "无", name: "其他", alias: 'engineother'},
        {value: "无", name: "机盖内沿", alias: 'themachinecover'},
        {value: "无", name: "机盖附件", alias: 'coveraccessories'},
        {value: "正常", name: "冷却液液位高度", alias: 'coolantlevel'},
        {value: "正常", name: "助力油量", alias: 'boosteroil'},
        {value: "正常", name: "雨刮水", alias: 'wiperwater'},
        {value: "正常", name: "制动液液位高度", alias: 'brakefluidlevel'},
        {value: "正常", name: "机油量", alias: 'oilquantity'},
        {value: "正常", name: "铭牌", alias: 'nameplate'},
        {value: "", name: "发动机舱检查备注", alias: 'engineroomcheckrem'}
    ];
}

// 06 --- carcockpit ---
Util.defaultCarcockpit = function () {
    return [
        {value: "是", name: "玻璃窗升降器、门窗工作是否正常", alias: 'glassdoorswindowsisnormal'},
        {value: "是", name: "左、右后视镜折叠装置工作是否正常", alias: 'leftrightrearisworking'},
        {value: "是", name: "车内是否整洁、无异味", alias: 'iscarcleannosmell'},
        {value: "是", name: "方向盘自由行程转角是否小于20度", alias: 'steeringwheelisthan20'},
        {value: "是", name: "车顶及周边内饰是否无破损、松动及裂缝和污迹", alias: 'roofsurroundingisstains'},

        {value: "是", name: "仪表台是否无划痕，配件是否无缺失", alias: 'isscratchesmissingparts'},
        {value: "是", name: "排档把手柄及护罩是否完好、无破损", alias: 'thehandleshielddamaged'},
        {value: "是", name: "储物盒是否无裂痕，配件是否无缺失", alias: 'storageboxismissing'},
        {value: "是", name: "天窗是否移动灵活、关闭正常", alias: 'skylightisflexibleclose'},
        {value: "是", name: "门窗密封条是否良好、无老化", alias: 'doorwindowisgoodaging'},

        {value: "是", name: "安全带结构是否完整、功能是否正常", alias: 'seatfunctionisnormal'},
        {value: "是", name: "驻车制动系统是否灵活有效", alias: 'parksysiseffective'},
        {value: "是", name: "车内后视镜、座椅是否完整、无破损、功能正常", alias: 'carmirrorseatisnormal'},
        {value: "是", name: "安全气囊是否无拆装修复", alias: 'airbagisnorepair'},
        {value: "是", name: "中央扶手是否无破损、划痕及裂缝和污迹", alias: 'centralhandrailisnormal'},

        {value: "是", name: "中控台是否无破损、划痕及裂缝和污迹", alias: 'consoleistheredamage'},
        {value: "是", name: "车辆是否无水泡痕迹", alias: 'vehiclehasnoblisters'},
        {value: "是", name: "车辆是否无火烧痕迹", alias: 'isvehiclehasfiretraces'},
        {value: "是", name: "车辆是否无重大事故", alias: 'nomajoraccidents'},
        {value: "", name: "驾驶舱检查备注", alias: 'cockpitcheckrem'}
    ];
}

// 07 --- carstart ---
Util.defaultCarstart = function () {
    return [
        {value: "是", name: "车辆启动是否顺畅（时间少于5秒，或者一次启动）", alias: 'vehicleisrunsmoothly'},
        {value: "是", name: "空调系统风量、方向调节、分区控制、自动控制、制冷工作是否正常", alias: 'aircondsysisnormal'},
        {value: "是", name: "仪表板指示灯显示是否正常，无故障报警", alias: 'dashboardisalarm'},
        {value: "是", name: "发动机在冷、热车状态下怠速运转是否稳定", alias: 'engineidlingisstability'},
        {value: "是", name: "各类灯光和调节功能是否正常", alias: 'alllightingisnormal'},
        {value: "是", name: "怠速运转时发动机是否无异响，空档状态下逐渐增加发动机转速，发动机声音过渡是否无异响", alias: 'idlespeedisnormal'},
        {value: "是", name: "泊车辅助系统工作是否正常", alias: 'parksysisworking'},
        {value: "是", name: "车辆排气是否无异常", alias: 'vehicleexhaustiswork'},
        {value: "是", name: "制动防抱死系统（ABS）工作是否正常", alias: 'antibraksysiswork'},
        {value: "", name: "其它/备注", alias: 'startotherrem'}
    ];
}

// 08 --- carroadtest ---
Util.defaultCarroadtest = function () {
    return [
        {value: "是", name: "发动机运转、加速是否正常", alias: 'engineoperationisnormal'},
        {value: "是", name: "制动系统工作是否正常有效、制动不跑偏", alias: 'brakesysworkisnormal'},
        {value: "是", name: "车辆启动前踩下制动踏板，保持5-10秒钟，踏板无向下移动的现象", alias: 'carstarvehiclehold'},
        {value: "是", name: "变速箱工作是否正常、无异响", alias: 'gearboxworkisnormal'},
        {value: "是", name: "踩住制动踏板启动发动机，踏板是否向下移动", alias: 'pressbrakestartengine'},
        {value: "是", name: "行驶过程中车辆底盘部位是否无异响", alias: 'chassisvehicleisdriving'},
        {value: "是", name: "行车制动系最大制动效能在踏板全行程的4/5以内达到", alias: 'maximumbrakmaxpedal'},
        {value: "是", name: "行驶过程中车辆转向部位是否无异响", alias: 'steeringposiisdriving'},
        {value: "是", name: "行驶是否无跑偏", alias: 'isrunningdeviation'},
        {value: "", name: "其它/备注", alias: 'roadtestotherrem'},
    ];
}

// 09 --- carbottom ---
Util.defaultCarbottom = function () {
    return [
        {value: "是", name: "发动机油底壳是否无渗漏", alias: 'isengineoilleakage'},
        {value: "是", name: "传动轴十字轴是否无松框", alias: 'isdrivetooseframe'},
        {value: "是", name: "变速箱体是否无渗漏", alias: 'gearboxisnoleakage'},
        {value: "是", name: "减震器是否无渗漏", alias: 'shockabsorberleakage'},
        {value: "是", name: "转向节臂球销是否无松动", alias: 'issteeringballloose'},
        {value: "是", name: "减震弹簧是否无损坏", alias: 'springisnotdamaged'},
        {value: "是", name: "三角球臂销是否无松动", alias: 'istriangleballloose'},
        {value: "", name: "其它/备注", alias: 'otherentinerem'}
    ];
}

// 10 --- carfunparts ---
Util.defaultCarfunparts = function () {
    return [
        {value: "", name: "发动机舱盖锁止", alias: 'enginehoodlock'},
        {value: "", name: "仪表板出风管道", alias: 'instrumentpanelduct'},
        {value: "", name: "发动机舱盖液压撑杆", alias: 'enginehatchhydraulicstrut'},
        {value: "", name: "中央集控", alias: 'centralizedcontrolcenter'},
        {value: "", name: "后门/后备箱液压支撑杆", alias: 'backdoortrunksupport'},
        {value: "", name: "备胎", alias: 'sparetire'},
        {value: "", name: "玻璃加热功能", alias: 'glassheatingfunction'},
        {value: "", name: "千斤顶", alias: 'liftingjack'},
        {value: "", name: "各车门锁止", alias: 'doorlock'},
        {value: "", name: "轮胎扳手及随车工具", alias: 'tyrewrenchvehicletool'},
        {value: "", name: "前后雨刮器", alias: 'trontwiper'},
        {value: "", name: "三角警示牌", alias: 'warningtriangle'},
        {value: "", name: "立柱密封胶条", alias: 'columnsealingstrip'},
        {value: "", name: "灭火器", alias: 'fireextinguisher'},
        {value: "", name: "排气管及消音器", alias: 'exhaustpipemuffler'},
        {value: "", name: "全套钥匙", alias: 'fullsetkey'},
        {value: "", name: "车轮轮毂", alias: 'wheelhub'},
        {value: "", name: "遥控器及功能", alias: 'controlandfunction'},
        {value: "", name: "车内后视镜", alias: 'rearviewmirror'},
        {value: "", name: "喇叭高低音色", alias: 'speakertone'},
        {value: "", name: "座椅调节与加热", alias: 'seatadjustmentheating'},
    ];
}

// 11 --- carpicture ---
Util.defaultCarpicture = function () {
    return [
        {
            value: "左前45°#null#null,右后45°#null#null,前排内饰#null#null,后排内饰#null#null,中控台#null#null,发动机舱#null#null",
            name: "必选图片",
            alias: 'mustpicture'
        },
        {
            value: "车辆正前方#null#null,车辆封面图#null#null,前车大灯#null#null,前车轮#null#null,前车门#null#null,车辆侧面#null#null,后车门#null#null,后车轮#null#null,后车大灯#null#null,车辆正后方#null#null,后备箱#null#null,变速杆#null#null,方向盘#null#null,仪表盘#null#null,油门踏板#null#null,天窗#null#null,车钥匙#null#null,铭牌#null#null",
            name: "其他图片",
            alias: 'otherpicture'
        }
    ];
}
// ------------------------------------------------------------------------------------------------------------------------

/*质保检查清单*/

Util.defaultGuaranteeEngineRoom = function () {
    return [
        {name: '电瓶静态检测（电极状况、存电量、休眠电流）', value: '正常', alias: 'option1',},
        {name: '发动机舱保险盒、电器、及机舱内线路、线束状况（排列正确，无破损、改装）', value: '正常', alias: 'option2',},
        {name: '制动液液位、液质（含水量、沸点、颜色）、渗漏情况', value: '正常', alias: 'option3',},
        {name: '发动机机油液位、油质、渗漏情况', value: '正常', alias: 'option4',},
        {name: '冷却液液位、液质、油水混合、冰点、渗漏情况', value: '正常', alias: 'option5',},
        {name: '助力转向油液位、油质、渗漏情况', value: '正常', alias: 'option6',},
        {name: '变速箱、油液位、油质、渗漏情况（带油标尺的变速箱）', value: '正常', alias: 'option7',},
        {name: '打开发动机加机油口盖，观察内部胶泥和积碳状况', value: '正常', alias: 'option8',},
        {name: '玻璃清洗液位及渗漏情况', value: '正常', alias: 'option9',},
        {name: '相关传动皮带的完好性及松紧状况（助力转向、发电机、压缩机等）', value: '正常', alias: 'option10',},
        {name: '发动机总成外观（无漏液、损伤、缺件）', value: '正常', alias: 'option11',},
        {name: '变速箱总成外观（无漏液、损伤、缺件）', value: '正常', alias: 'option12',},
        {name: '冷却系统部件及管路（无漏液、损伤、缺件）', value: '正常', alias: 'option13',},
        {name: '发动机润滑系统外部部件及管路（无漏液、损伤、缺件）', value: '正常', alias: 'option14',},
        {name: '空调系统发动机舱内部件及管路（无泄露、损伤、缺件）', value: '正常', alias: 'option15',},
        {name: '转向系统部件及管路（无漏液、损伤、缺件）', value: '正常', alias: 'option16',},
        {name: '发动机舱盖功能', value: '正常', alias: 'option7',},
        {name: '进气管道内有无油迹（根据结构情况判断涡轮增压串油）', value: '正常', alias: 'option18',},
        {name: '检查发动机舱有无水泡或火烧痕迹，发动机进气管进水痕迹', value: '正常', alias: 'option19',},
    ];
};

Util.defaultGuaranteeDriveRoomOne = function () {
    return [
        {name: '四车门开闭（无松动、异响，视情润滑铰链）', value: '正常', alias: 'option1',},
        {name: '门窗密封条是否良好', value: '正常', alias: 'option2',},
        {name: '车内后视镜、座椅、储物箱、扶手箱', value: '正常', alias: 'option3',},
        {name: '仪表台及相关器件', value: '正常', alias: 'option4',},
        {name: '安全带功能状况', value: '正常', alias: 'option5',},
        {name: '气囊位置外观', value: '正常', alias: 'option6',},
        {name: '换档手柄及护罩', value: '正常', alias: 'option7',},
        {name: '室内保险丝盒内器件及仪表台下方线路状况（排列正确、无破损）', value: '正常', alias: 'option8',},
        {name: '检查驾驶舱内有无水泡及火烧痕迹', value: '正常', alias: 'option9',},
    ];
};

Util.defaultGuaranteeDriveRoomTwo = function () {
    return [
        {name: '前、后示宽灯工作状况', value: '正常', alias: 'option1',},
        {name: '近、远光灯工作状况（亮度及照射位置正常）', value: '正常', alias: 'option2',},
        {name: '带灯光调节功能', value: '正常', alias: 'option3',},
        {name: '前、后雾灯工作状况', value: '正常', alias: 'option4',},
        {name: '各方向转向灯及警示灯工作状况', value: '正常', alias: 'option5',},
        {name: '制动灯、倒车灯工作状况', value: '正常', alias: 'option6',},
        {name: '仪表显示里程及各指示灯、照明灯工作状况', value: '正常', alias: 'option7',},
        {name: '前部与后部雨刮功能及清洗器功能', value: '正常', alias: 'option8',},
        {name: '收音机调节、音响/CD机功能', value: '正常', alias: 'option9',},
        {name: '卫星导航及中控触摸屏各功能', value: '正常', alias: 'option10',},
        {name: '天窗功能（操纵及部件工作正常，无异响、阻滞）', value: '正常', alias: 'option11',},
        {name: '玻璃窗升降器功能（操纵及部件工作正常，无异响、阻滞）', value: '正常', alias: 'option12',},
        {name: '左、右后视镜调节及折叠功能（操纵及部件工作正常，无异响、阻滞）', value: '正常', alias: 'option13',},
        {name: '电动座椅调节功能（操纵及部件工作正常，无异响、阻滞）', value: '正常', alias: 'option14',},
        {name: '中控门锁（遥控灵活、解闭锁功能及儿童锁功能正常', value: '正常', alias: 'option15',},
    ];
};

Util.defaultGuaranteeStart = function () {
    return [
        {name: '车辆启动是否顺畅（每次启动时间少于5秒，一次启动成功）', value: '正常', alias: 'option1',},
        {name: '仪表各指示灯（显示正常、无故障报警）', value: '正常', alias: 'option2',},
        {name: '发动机在冷、热车条件下怠速运转状况（转速正确、运转平稳）', value: '正常', alias: 'option3',},
        {name: '原地从怠速状态空加速至3000r/min（过渡平稳、迅速，无抖动）', value: '正常', alias: 'option4',},
        {name: '发动机及各联动部件运动状况（各转速工况无异响、共振、不正常摆动）', value: '正常', alias: 'option5',},
        {name: '变速器换挡手柄/拨片操纵（操纵灵活、档位正确）', value: '正常', alias: 'option6',},
        {name: '散热器风扇工作状况，（启停温度正确、不震动、外观无损）', value: '正常', alias: 'option7',},
        {name: '空调系统冷风（风量、出风口温度符合制造商规定标准）', value: '正常', alias: 'option8',},
        {name: '空调系统暖风（风量、出风口温度符合制造商规定标准）', value: '正常', alias: 'option9',},
        {name: '发电机全负荷电压（同时打开远光灯、空调等大负荷用电设备）', value: '正常', alias: 'option10',},
        {name: 'OBD检测，发动机、变速器电控系统及其它电控系统', value: '正常', alias: 'option11',},

    ];
};

Util.defaultGuaranteeUnderpanOne = function () {
    return [
        {name: '发动机底部联动部件运动状况（运转无异响，各联动部件运转正常、摆动量、跳动量符合制造商规定标准）', value: '正常', alias: 'option1',},
        {name: '排气管是否有漏气', value: '正常', alias: 'option2',},
        {name: '挂入低速档位，车轮悬空空转，观察传动轴及车轮运动状况（跳动量符合制造商规定标准）', value: '正常', alias: 'option3',},
    ];
};

Util.defaultGuaranteeUnderpanTwo = function () {
    return [
        {name: '发动机底部状况（无油液渗漏、外伤、碰擦损坏）', value: '正常', alias: 'option1',},
        {name: '变速箱底部状况（无油液渗漏、外伤、碰擦损坏）', value: '正常', alias: 'option2',},
        {name: '测量变速箱油位及油质（根据需要）', value: '正常', alias: 'option3',},
        {name: '转向器及液压转向系统管路和部件状况（无渗漏、损伤）', value: '正常', alias: 'option4',},
        {name: '制动系统总泵、ABS单元、管路、制动分泵等相关部件状况（无渗漏、损伤）', value: '正常', alias: 'option5',},
        {name: '燃油系统管路、油箱及相关部件状况（无渗漏、损伤、排列固定正确）', value: '正常', alias: 'option6',},
        {name: '车辆底部相关线束及器件状况（线管排列正确，无外观损伤）', value: '正常', alias: 'option7',},
        {name: '行驶系统悬架各连接臂、球销及支座状况', value: '正常', alias: 'option8',},
        {name: '行驶系统悬架减震弹簧（空气悬架无泄漏、塌陷，弹簧无断裂变形，减震器无漏油）', value: '正常', alias: 'option9',},
        {name: '转向系统各转向节、连接臂、拉杆、及球销状况（无变形、松旷、破损）', value: '正常', alias: 'option10',},
        {name: '传动系统传动轴、万向节、球笼（无变形、松旷、破损）', value: '正常', alias: 'option11',},
        {name: '行驶系统各连接臂、连接杆的橡胶套及缓冲垫（无变形、松旷、破损）', value: '正常', alias: 'option12',},
        {name: '行驶系车桥（无漏油、破裂、变形）', value: '正常', alias: 'option13',},
        {name: '制动系统制动蹄片状况（无开裂变形、蹄厚度＞1mm）', value: '正常', alias: 'option14',},
        {name: '制动系统制动盘状况（无开裂变形、厚度磨损＜2mm）', value: '正常', alias: 'option15',},
        {name: '手动转动车轮检查运动状况（转动灵活自如、无卡滞、松旷）', value: '正常', alias: 'option16',},
        {name: '轮胎表面状况(胎冠花纹深度＞1.6mm,表面无开裂、鼓包等外伤）', value: '正常', alias: 'option17',},
        {name: '检查底部有无火烧、水泡痕迹', value: '正常', alias: 'option18',},
    ];
};

Util.defaultGuaranteeRoadTest = function () {
    return [
        {name: '方向盘自由行程（自由转动量≤15°）', value: '正常', alias: 'option1',},
        {name: '制动系统助力器真功能检验（关闭发动机、踩踏板数次，启动发动机、制动踏板下移，关闭发动机、制动踏板在30S内无反弹', value: '正常', alias: 'option2',},
        {name: '制动系统电子或机械驻车制动功能（在坡度为 20%，正反两个方向保持固定不动，时间应大于等于 5min）', value: '正常', alias: 'option3',},
        {name: '原地打方向检验转向力矩（转向轻松自如、不沉重）', value: '正常', alias: 'option4',},
        {name: '手动变速器离合器实验（分离彻底、起步平稳、不打滑）', value: '正常', alias: 'option5',},
        {name: '自动变速器车辆起步时时滞试验（挂挡后车辆起步时滞时间＜1.2S）', value: '正常', alias: 'option6',},
        {name: '制动踏板力检验（产生最大制动效能时的踏板力≤500N）', value: '正常', alias: 'option7',},
        {name: '制动踏板有效行程（踏板有效行程应≥踏板全行程的四分之三）', value: '正常', alias: 'option8',},
        {name: '制动稳定性、平顺性检验（行车制动无跑偏、甩尾及异常抖动）', value: '正常', alias: 'option9',},
        {name: '行车转向性能实验（转向力矩、自动回正正常，不跑偏）', value: '正常', alias: 'option10',},
        {name: 'ABS功能检验（紧急制动，ABS正常工作）', value: '正常', alias: 'option11',},
        {name: '发动机在行驶过程中各工况情况（加减速、声响、平稳性）', value: '正常', alias: 'option12',},
        {name: '自动变速箱各档位运行检验（各档位工况正常，换档平稳，无冲击、无异响、无打滑，急加速有强制降档功能）', value: '正常', alias: 'option13',},
        {name: '手动变速箱各档位工况检验（各档位行驶正常，无换档困难、跳档、异响）', value: '正常', alias: 'option14',},
        {name: '底盘各部位状况（各道路状况及各行驶工况，车辆行驶平稳，无跑偏、抖动、异响等不正常现象）', value: '正常', alias: 'option15',},
        {name: '车辆减速滑行工况检验（无异常阻力和噪音）', value: '正常', alias: 'option16',},
    ];
};

Util.recordDetailsSimple = function () {
    return {
        location: {name: '地点', value: '贵阳', id: 1},
        phone: {name: '电话', value: ''},
        brand: {name: '车辆品牌', value: ''},
        series: {name: '车系', value: ''},
        kind: {name: '车型', value: ''},
        vin: {name: 'VIN码', value: ''},
        carNumber: {name: '车牌号', value: ''},
        meter: {name: '表显里程数', value: ''},
        color: {name: '车身颜色', value: ''},
        leftAColumn: {name: '左A柱', value: '正常'},
        leftBColumn: {name: '左B柱', value: '正常'},
        leftCColumn: {name: '左C柱', value: '正常'},
        rightAColumn: {name: '右A柱', value: '正常'},
        rightBColumn: {name: '右B柱', value: '正常'},
        rightCColumn: {name: '右C柱', value: '正常'},
        leftCarling: {name: '左前纵梁', value: '正常'},
        rightCarling: {name: '右前纵梁', value: '正常'},
        leftFontHang: {name: '左前减震器悬挂部位', value: '正常'},
        leftBackHang: {name: '右前减震器悬挂部位', value: '正常'},
        rightFontHang: {name: '左后减震器悬挂部位', value: '正常'},
        rightBackHang: {name: '右后减震器悬挂部位', value: '正常'},
        engineScrew: {name: '发动机舱螺丝是否扭动', value: '否'},
        fire: {name: '车辆是否有火烧痕迹', value: '否'},
        water: {name: '车辆是否有水泡痕迹', value: '否'},
        descriptionSel: {name: '车况描述', value: '好'},
        description: '',
        leftImage: {name: '左前45度', value: '左前45°#null#null'},
        rightImage: {name: '右后45度', value: '右后45°#null#null'},
    };
};

Util.recordHelpLook = function () {
    return [
        {
            value: "车前45°照#null#null,车身侧面照#null#null,车后部照#null#null,车后备箱照#null#null,车前座#null#null,车后座#null#null,驾驶室照#null#null,车辆方向盘#null#null,车辆公里数表照#null#null,车辆中控档位照#null#null,发动机舱照#null#null",
            name: "必选图片",
            alias: 'mustpicture'
        },
        {
            value: "行驶证#null#null,登记大本#null#null",
            name: "其他图片",
            alias: 'otherpicture'
        }
    ];
};

Util.loan = function () {
    return {
        name: {value: Util.isDevelop ? "老勾" : "", name: "姓名"},
        phone: {value: Util.isDevelop ? "13911103484" : "", name: "联系电话"},
        expire: {name: '是否有逾期', value: '否'},
        expireExInfo: {name: '是否有当前逾期', value: '是', exInfo: '需要提供当前逾期结清证明放款贷款'},
        loan: {name: '是否有未结清贷款', value: '否'},
        loanList: [{name: '房贷', value: '是', exValue: 1}, {name: '车贷', value: '是', exValue: 2}],
        hasLoan: {name: '是否贷过款或者用过信用卡', value: '否'},
        house: {name: '是否有房产证(含自建房，购房合同)', value: '否'},
        houseList: [{name: '自建房', value: '否', exValue: 1}, {name: '购房合同', value: '否', exValue: 2}],
        income: {name: '月收入', value: '3000以下'},
        marry: {name: '是否结婚', value: '否'},
        marryExInfo: {name: '是否愿意提供担保人', value: '是'},
        year: {name: '年龄', value: ''},
    };
};


Util.getPicParam = function (picArr, defPicArr) {
    if (!picArr || !Array.isArray(picArr)) {
        return defPicArr;
    }
    for (let i = 0, len = picArr.length; i < len; i++) {
        const picTemp = picArr[i];
        const defTemp = defPicArr[i];
        picTemp.value = this.getPicString(picTemp.value, defTemp.value);
    }
    return picArr;
};

Util.getPicString = function (picStr, defaultPicStr) {
    const picList = this.decodePhotoString(picStr);
    const defPicList = this.decodePhotoString(defaultPicStr);
    if (picList.length === defPicList.length) {
        let valid = true;
        for (let temp of picList) {
            const defTemp = defPicList.shift();
            if (temp.name !== defTemp.name) {
                valid = false;
                break;
            }
        }
        if (valid) {
            return picStr;
        }
    }
    return defaultPicStr;
};

export default Util;